GBML manual / Events

region_enter

Runs once, for every instance of this object, when the player arrives in a different region of a world than the last one they were in. Inside it, region_current() is the region just entered and region_previous() the one that was left. It also runs once when the game starts, for the region the player starts in.

Syntax

region_enter: fires once, on every instance, when the player arrives in a different region

Description

Runs once, for every instance of this object, when the player arrives in a different region than the last one they were in. Inside it, region_current is the region just entered and region_previous is the one that was left. It also runs once when the game starts, for the region the player starts in.

It follows the same house rule as region_entered: the game remembers the last region the player was in, so walking into a house and coming back out into the same region runs nothing, and coming out into a different region runs it once. Going to another world with world_go runs it too, after Region Exited.

In a long room cut into regions it runs when the object the camera follows walks across a border into another region, for every instance of the object in the room.

The event runs after the new part of the world has been made, so it runs for the objects of that part and for the ones that crossed with the player. An object in a part the player has just left is gone by then and does not run it.

This event is for the Game Boy Advance, like every part of World Mode. On another console it is grayed in the Add Event list.

Example

log_write(region_name());

Writes the name of the new region to the log, once per object that has this event.

On the GBA

The game remembers the last region the player was in. Walking into a house and coming back out into the same region is not a change, so nothing runs then. The event runs after the new part of the world has been made, so it runs for the objects of that part and for the ones that crossed with the player. Going to another world with world_go() runs it too, after Region Exited.

See also: region_exitregion_enteredregion_currentregion_previousWhat a region does in the gameroom_start